package com.unicloud.medical.oss.common.model.request;

import com.unicloud.medical.oss.common.util.CommonUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

@Getter
@NoArgsConstructor
@AllArgsConstructor
public class CopyObjectRequest extends CommonRequest {
    /**
     * 桶名称
     */
    private String bucketName;

    /**
     * 来源对象名称
     */
    String sourceObjectName;

    /**
     * 目标对象名称
     */
    String targetObjectName;

    public void setBucketName(String bucketName) {
        this.bucketName = StringUtils.trimToNull(bucketName);
    }



    public void setSourceObjectName(String sourceObjectName) {
        this.sourceObjectName = CommonUtil.formatObjectName(sourceObjectName);
    }

    public void setTargetObjectName(String targetObjectName) {
        this.targetObjectName = CommonUtil.formatObjectName(targetObjectName);
    }

    @Override
    public String toString() {
        return "{"
                + "\"ossName\":\""
                + ossName + '\"'
                + ",\"bucketName\":\""
                + bucketName + '\"'
                + ",\"sourceObjectName\":\""
                + sourceObjectName + '\"'
                + ",\"targetObjectName\":\""
                + targetObjectName + '\"'
                + "}";
    }
}
